#ifndef WINDOW_H_
#define WINDOW_H_

#include "Point2d.h"
#include "UILayout.h"
#include "AbsoluteLayout.h"
#include "UILabel.h"
#include "UIButton.h"
#include "UITextEntry.h"
#include <string>
#include <list>
#include <map>

namespace Lame3d
{
	class Window
	{
		public:
			Window(const std::string &name, const Point2d &size, const Point2d &loc, UILayout *layout=NULL);
			~Window();
			
			const std::string& Name() const;
			
			const Point2d& Size() const;
			void Size(const Point2d &s);
			
			const Point2d& Location() const;
			Point2d& Location();
			
			/* Argument given in global coordinates */
			bool Contains(const Point2d &pt) const;
			/* Argument given in global coordinates */
			UIElement* ElementAt(const Point2d &pt);
			
			bool Resizable() const;
			void Resizable(bool b);
			
			void Add(UILabel *l, UILayoutProperties *layoutProps);
			std::list<UILabel*>::const_iterator LabelsBegin() const;
			std::list<UILabel*>::const_iterator LabelsEnd() const;
			
			void Add(UIButton *b, UILayoutProperties *layoutProps);
			std::list<UIButton*>::const_iterator ButtonsBegin() const;
			std::list<UIButton*>::const_iterator ButtonsEnd() const;
			
			void Add(UITextEntry *e, UILayoutProperties *layoutProps);
			std::list<UITextEntry*>::const_iterator TextEntriesBegin() const;
			std::list<UITextEntry*>::const_iterator TextEntriesEnd() const;
			
			void Remove(const std::string &n);
			
			float Opacity() const;
			void Opacity(float f);
			
			bool Deleting() const;
			void Delete();
			
		protected:
			std::string name;
			Point2d size;
			Point2d location;
			
			bool resizable;
			
			UILayout *layout;
			
			float opacity;
			bool deleting;
			
			std::list<UILabel*> labels;
			std::list<UIButton*> buttons;
			std::list<UITextEntry*> entries;
			std::map<std::string, UIElement*> elements;
	};
}

#endif /*WINDOW_H_*/
